package database

import (
	"gitee.com/showurl/ugly/config"
	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
	"gorm.io/gorm/logger"
)

var DB *gorm.DB

func InitDB() {
	gormConfig := &gorm.Config{
		Logger: logger.Default.LogMode(logger.Info),
	}
	db, err := gorm.Open(sqlite.Open(config.Config.App.Sqlite.Path), gormConfig)
	if err != nil {
		panic(err)
	}
	DB = db
}
